package com.example.demo.controller;

import com.alibaba.fastjson.JSON;
import com.example.demo.Result;
import com.example.demo.crypto.DecryptRequest;
import com.example.demo.crypto.EncryptResponse;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/test")
public class TestController {

//    @DecryptRequest //请求体需要解密
    @EncryptResponse //返回体需要加密
    @PostMapping(value = "/enc")
    public Result<byte[]> enc(@RequestBody int body) {
        System.out.println(body);
        Result<byte[]> result = new Result();
        result.resultSuccess(JSON.toJSONBytes(body));
        return result;
    }

    @RequestMapping("test")
    public String testPathVal(@PathVariable String str){
        return null;
    }
}
